<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Vanilla Objects</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Vanilla Objects' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">final</a></li><li><a href="index.html#2">Chapter 2: Mechanism</a></li><li><b>Vanilla Objects</b></li></ul></div>
<p class="purpose">How the vanilla code generation strategy handles instances, kinds, and properties.</p>

<ul class="toc"><li><a href="2-vo.html#SP1">&#167;1. Properties</a></li><li><a href="2-vo.html#SP4">&#167;4. Instances, kinds and values of properties</a></li><li><a href="2-vo.html#SP6">&#167;6. Utility functions</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Properties.</b>Early in code-generation, we declare the properties. Generators might want to
represent these in all kinds of ways for the sake of efficiency; on Inform 6,
for example, some either-or properties of objects may be represented as
"attributes". But that's not our concern. We will try to keep the model as
simple as possible here.
</p>

<p class="commentary">What we assume is that:
</p>

<ul class="items"><li>(a) A property <span class="extract"><span class="extract-syntax">P</span></span> is represented at runtime by a small word array.
</li><li>(b) The meaning of the first two words, <span class="extract"><span class="extract-syntax">P--&gt;0</span></span> and <span class="extract"><span class="extract-syntax">P--&gt;1</span></span>, is up to the
generator. It can put anything it likes in them.
</li><li>(c) <span class="extract"><span class="extract-syntax">P--&gt;2</span></span> is 1 for either-or properties, 0 for all others.
</li><li>(d) <span class="extract"><span class="extract-syntax">P--&gt;3</span></span> is the printed name of the property, for use in debugging or
runtime problem messages.
</li><li>(e) <span class="extract"><span class="extract-syntax">P--&gt;4</span></span> onwards is a set of permissions, a concise representation of
which instances can have the property in question. This is 0-terminated.
</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>The biggest complication we face is that the linking process has left us, in
some cases, with multiple property declarations for what is actually the same
property.
</p>

<p class="commentary">For example, this arises when a property is defined in Inform 7 source like so:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">A</span><span class="plain-syntax"> </span><span class="identifier-syntax">room</span><span class="plain-syntax"> </span><span class="identifier-syntax">can</span><span class="plain-syntax"> </span><span class="identifier-syntax">be</span><span class="plain-syntax"> </span><span class="identifier-syntax">privately</span><span class="plain-syntax">-</span><span class="identifier-syntax">named</span><span class="plain-syntax"> </span><span class="identifier-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">publicly</span><span class="plain-syntax">-</span><span class="identifier-syntax">named</span><span class="plain-syntax">.</span>
<span class="identifier-syntax">The</span><span class="plain-syntax"> </span><span class="identifier-syntax">privately</span><span class="plain-syntax">-</span><span class="identifier-syntax">named</span><span class="plain-syntax"> </span><span class="identifier-syntax">property</span><span class="plain-syntax"> </span><span class="identifier-syntax">translates</span><span class="plain-syntax"> </span><span class="identifier-syntax">into</span><span class="plain-syntax"> </span><span class="identifier-syntax">Inter</span><span class="plain-syntax"> </span><span class="identifier-syntax">as</span><span class="plain-syntax"> </span><span class="string-syntax">"privately_named"</span><span class="plain-syntax">.</span>
</pre>
<p class="commentary">...where the property <span class="extract"><span class="extract-syntax">privately_named</span></span> actually originates in a kit, written
in Inform 6 notation like so:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">Attribute</span><span class="plain-syntax"> </span><span class="identifier-syntax">privately_named</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary">We now have two property declarations, one in the Standard Rules module, the
other in the BasicInformKit module. It's tempting to have the linker delete
the Standard Rules one and convert references to it to point them to the kit
definition, but this is not a good idea because the kit definition doesn't
have the metadata or permissions which the Standard Rules definition has. So
we keep both in play, and reconcile them in the code below.
</p>

<p class="commentary">It gets worse: the Standard Rules properties "lighted" and "lit", though different &mdash;
one applies to rooms, one to things &mdash; both translate to the same BasicInformKit
property <span class="extract"><span class="extract-syntax">light</span></span>. At present that's the worst case scenario (i.e., three different
properties all coinciding) but we won't assume that.
</p>

<p class="commentary">So what we do is to work through the properties and group them into equivalence
classes by their final identifier names. Here, for example, we recognise these
two properties as the same because they both want to be called <span class="extract"><span class="extract-syntax">privately_named</span></span>.
By scanning the assimilated properties (i.e. those from kits) first, we ensure
that the first one found in each set will be the definitive source of the property.
But it will likely be the later members of the set which have the necessary
metadata attached.
</p>

<p class="commentary">Of course, in the benign case where there is just one Inform 7-level definition
of a property, <span class="extract"><span class="extract-syntax">first_with_name</span></span> and <span class="extract"><span class="extract-syntax">last_with_name</span></span> will be the same, and the
list will be a singleton.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::declare_properties</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::declare_properties</span></span>:<br/>Vanilla - <a href="2-vnl.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">first_with_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::new</span><span class="plain-syntax">(1024, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">); </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">inter_symbol</span></span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">last_with_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::new</span><span class="plain-syntax">(1024, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">); </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">inter_symbol</span></span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">all_with_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::new</span><span class="plain-syntax">(1024, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">); </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">linked_list</span></span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">inter_symbol</span></span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">assimilated_properties</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Group the properties by name</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unassimilated_properties</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Group the properties by name</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">assimilated_properties</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2" class="named-paragraph-link"><span class="named-paragraph">Declare one property for each name group</span><span class="named-paragraph-number">2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unassimilated_properties</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2" class="named-paragraph-link"><span class="named-paragraph">Declare one property for each name group</span><span class="named-paragraph-number">2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Group the properties by name</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Dictionaries::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">last_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">) == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::create</span><span class="plain-syntax">(</span><span class="identifier-syntax">last_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::write_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">last_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::create</span><span class="plain-syntax">(</span><span class="identifier-syntax">all_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::write_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">all_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::write_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">last_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">all_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2">&#167;2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2" class="paragraph-anchor"></a><b>&#167;2.2. </b>So here's an annoyance. We will need two identifier names for each property.
One is the metadata array, while the other will probably be used by the generator
to hold the actual storage &mdash; that other is called the "inner name".
</p>

<p class="commentary">In the case of our <span class="extract"><span class="extract-syntax">privately_named</span></span> example, the metadata array will be called
something like <span class="extract"><span class="extract-syntax">A_privately_named</span></span>, and any references to the property in kit
code or in Inform 7 source text will compile to this array. The inner name will
preserve the original identifier <span class="extract"><span class="extract-syntax">privately_named</span></span>, and will likely be used by
the final generator for where a property value is actually stored. For Inform 6,
for example, we will have:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">A_privately_named</span><span class="plain-syntax"> --&gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">     </span><span class="constant-syntax">2</span>
<span class="plain-syntax">                      --&gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">     </span><span class="identifier-syntax">privately_named</span><span class="plain-syntax"> (</span><span class="identifier-syntax">an</span><span class="plain-syntax"> </span><span class="identifier-syntax">I6</span><span class="plain-syntax"> </span><span class="identifier-syntax">attribute</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                      --&gt; </span><span class="constant-syntax">2</span><span class="plain-syntax">     </span><span class="constant-syntax">1</span>
<span class="plain-syntax">                      --&gt; </span><span class="constant-syntax">3</span><span class="plain-syntax">     </span><span class="string-syntax">"privately named"</span>
<span class="plain-syntax">                      --&gt; </span><span class="constant-syntax">4</span><span class="plain-syntax">     ... </span><span class="identifier-syntax">permissions</span><span class="plain-syntax"> </span><span class="identifier-syntax">follow</span>
</pre>
<p class="commentary">In some ways it would be more convenient to use these names the other way around:
to call the array itself <span class="extract"><span class="extract-syntax">privately_named</span></span> and have the inner identifier be
something like <span class="extract"><span class="extract-syntax">I_privately_named</span></span>. But this fails on Inform 6 in exasperating
ways because of the built-in <span class="extract"><span class="extract-syntax">name</span></span> property, whose name cannot be declared or
altered.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare one property for each name group</span><span class="named-paragraph-number">2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Dictionaries::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">) == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">PROPERTY_ALLOCATION</span><span class="plain-syntax">, </span><span class="string-syntax">"! NEW name=%S   sname=%S   eor=%d   assim=%d\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><a href="2-vo.html#SP10" class="function-link"><span class="function-syntax">VanillaObjects::is_either_or_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">SymbolAnnotation::get_b</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">ASSIMILATED_IANN</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::create</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::write_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SymbolAnnotation::set_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">INNER_PROPERTY_NAME_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1" class="named-paragraph-link"><span class="named-paragraph">Set the translation to a new metadata array</span><span class="named-paragraph-number">2.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">PROPERTY_ALLOCATION</span><span class="plain-syntax">, </span><span class="string-syntax">"! OLD name=%S   sname=%S   eor=%d   assim=%d\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><a href="2-vo.html#SP10" class="function-link"><span class="function-syntax">VanillaObjects::is_either_or_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">SymbolAnnotation::get_b</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">ASSIMILATED_IANN</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">existing_prop_name</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> = </span><a href="2-vo.html#SP3" class="function-link"><span class="function-syntax">VanillaObjects::inner_property_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">existing_prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">InterSymbol::set_translate</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="identifier-syntax">existing_prop_name</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SymbolAnnotation::set_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">INNER_PROPERTY_NAME_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">PROPERTY_ALLOCATION</span><span class="plain-syntax">, </span><span class="string-syntax">"! Translation %S, inner name %S\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">), </span><a href="2-vo.html#SP3" class="function-link"><span class="function-syntax">VanillaObjects::inner_property_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2">&#167;2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1" class="paragraph-anchor"></a><b>&#167;2.2.1. </b>Note that <a href="2-cg2.html#SP17" class="internal">Generators::declare_property</a> calls the generator to ask it to
create the first two entries in the metadata array. Those can be anything the
generator wants.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Set the translation to a new metadata array</span><span class="named-paragraph-number">2.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">array_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">array_name</span><span class="plain-syntax">, </span><span class="string-syntax">"A_%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">InterSymbol::set_translate</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">array_name</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">all_forms</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">all_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">segmentation_pos</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">array_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">, -1, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP17" class="function-link"><span class="function-syntax">Generators::declare_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">all_forms</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1_1" class="named-paragraph-link"><span class="named-paragraph">Write the either-or flag</span><span class="named-paragraph-number">2.2.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1_2" class="named-paragraph-link"><span class="named-paragraph">Write the property name in double quotes</span><span class="named-paragraph-number">2.2.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1_3" class="named-paragraph-link"><span class="named-paragraph">Write a list of kinds or objects which are permitted to have this property</span><span class="named-paragraph-number">2.2.1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::mangled_array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"NULL"</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">, -1, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2">&#167;2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1_1" class="paragraph-anchor"></a><b>&#167;2.2.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write the either-or flag</span><span class="named-paragraph-number">2.2.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vo.html#SP10" class="function-link"><span class="function-syntax">VanillaObjects::is_either_or_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"0"</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2_1">&#167;2.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1_2" class="paragraph-anchor"></a><b>&#167;2.2.1.2. </b>Note that we extract the printed name from the last property in the set,
because that will come from an I7 source text definition.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write the property name in double quotes</span><span class="named-paragraph-number">2.2.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">last_prop_name</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">last_with_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pname</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Metadata::optional_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">last_prop_name</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"^name"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pname</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">pname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"&lt;nameless&gt;"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">entry</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="2-cg.html#SP13" class="function-link"><span class="function-syntax">CodeGen::select_temporary</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">entry</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP20" class="function-link"><span class="function-syntax">Generators::compile_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">pname</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg.html#SP13" class="function-link"><span class="function-syntax">CodeGen::deselect_temporary</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">entry</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">entry</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2_1">&#167;2.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1_3" class="paragraph-anchor"></a><b>&#167;2.2.1.3. </b>Type-safety at runtime is managed with a hybrid of compile-time and runtime
checking. Compile-time checking polices all uses of properties of values other
than objects, but it will usually allow any object property of any object to
be accessed, because it's not usually possible for the typechecker to know if
an object value <span class="extract"><span class="extract-syntax">O</span></span> is a vehicle, a direction, and so on. For this reason
some runtime checking is needed, and to perform that checking, properties need
a list of permissions to be stored in memory. This is where.
</p>

<p class="commentary">Note that permissions are accumulated for all of the properties in a given
name set. In the case of "lighted" and "lit" and <span class="extract"><span class="extract-syntax">light</span></span>, therefore, the
permissions written will be those for "lighted" (rooms, basically) and then
those for "lit" (things); <span class="extract"><span class="extract-syntax">light</span></span>, the WorldModelKit original, has no permissions &mdash;
assimilated properties never do have.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write a list of kinds or objects which are permitted to have this property</span><span class="named-paragraph-number">2.2.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eprop_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">eprop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">all_forms</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">EVL</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">InterWarehouse::get_node_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterTree::warehouse</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">PropertyInstruction::permissions_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">eprop_name</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1_3_1" class="named-paragraph-link"><span class="named-paragraph">List any kind of object with an explicit permission</span><span class="named-paragraph-number">2.2.1.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1_3_2" class="named-paragraph-link"><span class="named-paragraph">List any individual instance with an explicit permission</span><span class="named-paragraph-number">2.2.1.3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP2_2_1_3_3" class="named-paragraph-link"><span class="named-paragraph">List all top-level kinds if "object" itself has an explicit permission</span><span class="named-paragraph-number">2.2.1.3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2_1">&#167;2.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1_3_1" class="paragraph-anchor"></a><b>&#167;2.2.1.3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">List any kind of object with an explicit permission</span><span class="named-paragraph-number">2.2.1.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kinds_in_declaration_order</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vo.html#SP7" class="function-link"><span class="function-syntax">VanillaObjects::is_kind_of_object</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">EVL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PermissionInstruction::owner</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::symbol_array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2_1_3">&#167;2.2.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1_3_2" class="paragraph-anchor"></a><b>&#167;2.2.1.3.2. </b>An unusual feature of Inform as a programming language is that individual objects
can be given properties, even when other objects of the same kind may lack them. So:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">List any individual instance with an explicit permission</span><span class="named-paragraph-number">2.2.1.3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">instances_in_declaration_order</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vo.html#SP7" class="function-link"><span class="function-syntax">VanillaObjects::is_kind_of_object</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">InstanceInstruction::typename</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">EVL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PermissionInstruction::owner</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::symbol_array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2_1_3">&#167;2.2.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2_1_3_3" class="paragraph-anchor"></a><b>&#167;2.2.1.3.3. </b>It's happily a rare occurrence, but "object" itself can have properties &mdash; so
that every object of any kind has permission to have that. We convey that by giving
permission for every top-level kind of object. (There are typically only four of
these top-level kinds, and not many properties have these permissions, so it's
not as wasteful as it looks.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">List all top-level kinds if "object" itself has an explicit permission</span><span class="named-paragraph-number">2.2.1.3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">EVL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PermissionInstruction::owner</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::mangled_array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"K0_kind"</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kinds_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TypenameInstruction::super</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">) == </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::symbol_array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="constant-syntax">WORD_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP2_2_1_3">&#167;2.2.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>Generators can then access the inner name (if they want it) thus:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">VanillaObjects::inner_property_name</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::inner_property_name</span></span>:<br/><a href="2-vo.html#SP2_2">&#167;2.2</a><br/>Inform 6 Objects - <a href="4-i6o.html#SP4">&#167;4</a>, <a href="4-i6o.html#SP9">&#167;9</a><br/>Inform 6 Code - <a href="4-i6c2.html#SP9">&#167;9</a><br/>C Object Model - <a href="5-com.html#SP20">&#167;20</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SymbolAnnotation::get_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">, </span><span class="identifier-syntax">INNER_PROPERTY_NAME_IANN</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"&lt;nameless&gt;"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">inner_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Instances, kinds and values of properties.</b>Round two is to make declarations of our kinds and instances. Again, we want to
make as few assumptions as possible about the eventual runtime representation
of these ideas, but that will not be no assumptions.
</p>

<p class="commentary">In particular, whereas generators can stash object properties more or less in
any way they like, they are required to stash properties of non-object values
in small arrays called "sticks", which mimic table columns. This is imposed by
the language itself, which allows properties of values to be defined by tables
of values.
</p>

<p class="commentary">So while it would be attractive here to make no distinction between objects
and other property-owners, we cannot do so.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::declare_kinds_and_instances</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::declare_kinds_and_instances</span></span>:<br/>Vanilla - <a href="2-vnl.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1" class="named-paragraph-link"><span class="named-paragraph">Declare kinds of value</span><span class="named-paragraph-number">4.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_2" class="named-paragraph-link"><span class="named-paragraph">Declare kinds of object</span><span class="named-paragraph-number">4.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_3" class="named-paragraph-link"><span class="named-paragraph">Declare instances</span><span class="named-paragraph-number">4.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4_1" class="paragraph-anchor"></a><b>&#167;4.1. </b>We start then with kinds which have properties but are not kinds of objects.
We want to ensure that no property is assigned more than once (for the same kind),
so we use "marks" on those already done.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare kinds of value</span><span class="named-paragraph-number">4.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">unique_kovp_id</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kinds_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vo.html#SP8" class="function-link"><span class="function-syntax">VanillaObjects::value_kind_with_properties</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">segmentation_pos</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::declare_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unassimilated_properties</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="2-cg.html#SP17" class="function-link"><span class="function-syntax">CodeGen::unmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1" class="named-paragraph-link"><span class="named-paragraph">Declare properties which every instance of this kind of value can have</span><span class="named-paragraph-number">4.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_2" class="named-paragraph-link"><span class="named-paragraph">Declare properties which only some instances of this kind of value can have</span><span class="named-paragraph-number">4.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::end_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_1_1" class="paragraph-anchor"></a><b>&#167;4.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare properties which every instance of this kind of value can have</span><span class="named-paragraph-number">4.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">FL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TypenameInstruction::permissions_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Work through this node list of permissions</span><span class="named-paragraph-number">4.1.1.1</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_1">&#167;4.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_1_2" class="paragraph-anchor"></a><b>&#167;4.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare properties which only some instances of this kind of value can have</span><span class="named-paragraph-number">4.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">instances_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TypenameInstruction::is_a</span><span class="plain-syntax">(</span><span class="identifier-syntax">InstanceInstruction::typename</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">), </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">FL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InstanceInstruction::permissions_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Work through this node list of permissions</span><span class="named-paragraph-number">4.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_1">&#167;4.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_1_1_1" class="paragraph-anchor"></a><b>&#167;4.1.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Work through this node list of permissions</span><span class="named-paragraph-number">4.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">FL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PermissionInstruction::property</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no property"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-cg.html#SP17" class="function-link"><span class="function-syntax">CodeGen::marked</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-cg.html#SP17" class="function-link"><span class="function-syntax">CodeGen::mark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Assign the property values for this property</span><span class="named-paragraph-number">4.1.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_1_1">&#167;4.1.1</a> and <a href="2-vo.html#SP4_1_2">&#167;4.1.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_1_1_1_1" class="paragraph-anchor"></a><b>&#167;4.1.1.1.1. </b>In the case where a kind of value has been created by table, as in this example:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Planet</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">value</span><span class="plain-syntax">. </span><span class="identifier-syntax">The</span><span class="plain-syntax"> </span><span class="identifier-syntax">planets</span><span class="plain-syntax"> </span><span class="identifier-syntax">are</span><span class="plain-syntax"> </span><span class="identifier-syntax">defined</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">Table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">Outer</span><span class="plain-syntax"> </span><span class="identifier-syntax">Planets</span><span class="plain-syntax">.</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">Outer</span><span class="plain-syntax"> </span><span class="identifier-syntax">Planets</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">planet</span><span class="plain-syntax">      </span><span class="identifier-syntax">semimajor</span><span class="plain-syntax"> </span><span class="identifier-syntax">axis</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Jupiter</span><span class="plain-syntax">     </span><span class="constant-syntax">5</span><span class="plain-syntax"> </span><span class="identifier-syntax">AU</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Saturn</span><span class="plain-syntax">      </span><span class="constant-syntax">10</span><span class="plain-syntax"> </span><span class="identifier-syntax">AU</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Uranus</span><span class="plain-syntax">      </span><span class="constant-syntax">19</span><span class="plain-syntax"> </span><span class="identifier-syntax">AU</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Neptune</span><span class="plain-syntax">     </span><span class="constant-syntax">30</span><span class="plain-syntax"> </span><span class="identifier-syntax">AU</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Pluto</span><span class="plain-syntax">       </span><span class="constant-syntax">39</span><span class="plain-syntax"> </span><span class="identifier-syntax">AU</span>
</pre>
<p class="commentary">the property "semimajor axis" is already stored in a table column. That becomes
our stick array. But in other cases, where the instances have not been created
by table, no sticks exist and we must compile them.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Assign the property values for this property</span><span class="named-paragraph-number">4.1.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ident</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">store</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PermissionInstruction::storage</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">store</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ident</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="identifier-syntax">store</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ident</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">ident</span><span class="plain-syntax">, </span><span class="string-syntax">"KOVP_%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">unique_kovp_id</span><span class="plain-syntax">++);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Compile a stick of property values and put its address here</span><span class="named-paragraph-number">4.1.1.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::assign_properties</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">ident</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_1_1_1">&#167;4.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_1_1_1_1_1" class="paragraph-anchor"></a><b>&#167;4.1.1.1.1.1. </b>These little arrays are sticks of property values, and they are laid out
as if they were column arrays in a Table data structure. This means they must
be <span class="extract"><span class="extract-syntax">TABLE_ARRAY_FORMAT</span></span> arrays (which wastes one word of memory) and must have
blanked-out table column header words at the front (which wastes a further
<span class="extract"><span class="extract-syntax">COL_HSIZE</span></span> words). But the cost is a simple overhead, not rising with the
number of instances, and is worth it for simplicity and speed.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile a stick of property values and put its address here</span><span class="named-paragraph-number">4.1.1.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">segmentation_pos</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">ident</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"0"</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"0"</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">instances_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TypenameInstruction::is_a</span><span class="plain-syntax">(</span><span class="identifier-syntax">InstanceInstruction::typename</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">), </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PVL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InstanceInstruction::properties_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Work through this node list of values</span><span class="named-paragraph-number">4.1.1.1.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PVL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TypenameInstruction::properties_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_1_1_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Work through this node list of values</span><span class="named-paragraph-number">4.1.1.1.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"0"</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_1_1_1_1">&#167;4.1.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_1_1_1_1_1_1" class="paragraph-anchor"></a><b>&#167;4.1.1.1.1.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Work through this node list of values</span><span class="named-paragraph-number">4.1.1.1.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">Y</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">Y</span><span class="plain-syntax">, </span><span class="identifier-syntax">PVL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PropertyValueInstruction::property</span><span class="plain-syntax">(</span><span class="identifier-syntax">Y</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">p_name</span><span class="plain-syntax"> == </span><span class="identifier-syntax">prop_name</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">found</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PropertyValueInstruction::value</span><span class="plain-syntax">(</span><span class="identifier-syntax">Y</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="2-cg.html#SP13" class="function-link"><span class="function-syntax">CodeGen::select_temporary</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-cg.html#SP18" class="function-link"><span class="function-syntax">CodeGen::pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">Y</span><span class="plain-syntax">, </span><span class="identifier-syntax">pair</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-cg.html#SP13" class="function-link"><span class="function-syntax">CodeGen::deselect_temporary</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_1_1_1_1_1">&#167;4.1.1.1.1.1</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP4_2" class="paragraph-anchor"></a><b>&#167;4.2. </b>So now for the objects. First we declare each kind of object, first calling
<a href="2-cg2.html#SP19" class="internal">Generators::declare_kind</a>, then <a href="2-cg2.html#SP19" class="internal">Generators::assign_property</a> for each
property value, and then <a href="2-cg2.html#SP19" class="internal">Generators::end_kind</a>.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare kinds of object</span><span class="named-paragraph-number">4.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kinds_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">)) ||</span>
<span class="plain-syntax">            (</span><a href="2-vo.html#SP7" class="function-link"><span class="function-syntax">VanillaObjects::is_kind_of_object</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">segmentation_pos</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::declare_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-vo.html#SP5" class="function-link"><span class="function-syntax">VanillaObjects::append</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">FL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TypenameInstruction::properties_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_2_1" class="named-paragraph-link"><span class="named-paragraph">Declare the properties of this kind or instance</span><span class="named-paragraph-number">4.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::end_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_3" class="paragraph-anchor"></a><b>&#167;4.3. </b>And then the instances. As with kinds, we call <a href="2-cg2.html#SP19" class="internal">Generators::declare_instance</a>,
then give some property values, then call <a href="2-cg2.html#SP19" class="internal">Generators::end_instance</a>.
</p>

<p class="commentary">With instances of values, note that we have no property assignment to do: that
was all taken care of with the sticks of property values already declared.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare instances</span><span class="named-paragraph-number">4.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">instances_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InstanceInstruction::typename</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">object_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">object_kind</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">TypenameInstruction::is_a</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">InterValuePairs::to_number</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">InstanceInstruction::enumerated_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">segmentation_pos</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::declare_instance</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inst_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TypenameInstruction::is_a</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><a href="2-vo.html#SP5" class="function-link"><span class="function-syntax">VanillaObjects::append</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">FL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InstanceInstruction::properties_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-vo.html#SP4_2_1" class="named-paragraph-link"><span class="named-paragraph">Declare the properties of this kind or instance</span><span class="named-paragraph-number">4.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::end_instance</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inst_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_2_1" class="paragraph-anchor"></a><b>&#167;4.2.1. </b>The following, then, is used either for properties of a kind of object, or
properties of an instance of object, and issues a stream of <a href="2-cg2.html#SP19" class="internal">Generators::assign_property</a>
function calls.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Declare the properties of this kind or instance</span><span class="named-paragraph-number">4.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">FL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP19" class="function-link"><span class="function-syntax">Generators::assign_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PropertyValueInstruction::property</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PropertyValueInstruction::value</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vo.html#SP4_2">&#167;4.2</a> and <a href="2-vo.html#SP4_3">&#167;4.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>That just leaves the following horrible function, which is called for each
kind or instance of object, and passes raw splat matter down into the declaration
which the generator is making.
</p>

<p class="commentary">This is a bad idea, because it presupposes which generator is being used, or
at any rate what the syntax will be. It arises from source text like this:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">Include</span><span class="plain-syntax"> (-</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">with</span><span class="plain-syntax"> </span><span class="identifier-syntax">before</span><span class="plain-syntax"> </span><span class="comment-syntax">[; Go: return 1; ]</span><span class="plain-syntax">,</span>
<span class="plain-syntax">-) </span><span class="identifier-syntax">when</span><span class="plain-syntax"> </span><span class="identifier-syntax">defining</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">rideable</span><span class="plain-syntax"> </span><span class="identifier-syntax">vehicle</span><span class="plain-syntax">.</span>
</pre>
<p class="commentary">...which should probably not be allowed. The splat is the text between <span class="extract"><span class="extract-syntax">(-</span></span>
and <span class="extract"><span class="extract-syntax">-)</span></span> here, and as can be seen, it's in Inform 6 syntax, which would be bad
news for, say, the C generator.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::append</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::append</span></span>:<br/><a href="2-vo.html#SP4_2">&#167;4.2</a>, <a href="2-vo.html#SP4_3">&#167;4.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">symb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">OUT</span><span class="plain-syntax"> = </span><a href="2-cg.html#SP14" class="function-link"><span class="function-syntax">CodeGen::current</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SymbolAnnotation::get_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">symb</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">APPEND_IANN</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><a href="2-vnl.html#SP5" class="function-link"><span class="function-syntax">Vanilla::splat_matter</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Utility functions.</b>Returns the weak ID of a kind, which is a small integer known at compile time.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::weak_id</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::weak_id</span></span>:<br/>Inform 6 Objects - <a href="4-i6o.html#SP5_2">&#167;5.2</a>, <a href="4-i6o.html#SP13_2">&#167;13.2</a>, <a href="4-i6o.html#SP13_3">&#167;13.3</a><br/>C Object Model - <a href="5-com.html#SP25">&#167;25</a>, <a href="5-com.html#SP25_1">&#167;25.1</a>, <a href="5-com.html#SP25_2">&#167;25.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterPackage::container</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">definition</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">weak_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Metadata::optional_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^weak_id"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">alt_N</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">weak_s</span><span class="plain-syntax">) </span><span class="identifier-syntax">alt_N</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSymbol::evaluate_to_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">weak_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">alt_N</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">alt_N</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b><span class="extract"><span class="extract-syntax">TRUE</span></span> for something like "thing" or "room", but <span class="extract"><span class="extract-syntax">FALSE</span></span> for "object" itself.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::is_kind_of_object</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::is_kind_of_object</span></span>:<br/><a href="2-vo.html#SP2_2_1_3_1">&#167;2.2.1.3.1</a>, <a href="2-vo.html#SP2_2_1_3_2">&#167;2.2.1.3.2</a>, <a href="2-vo.html#SP4_2">&#167;4.2</a>, <a href="2-vo.html#SP8">&#167;8</a>, <a href="2-vo.html#SP9">&#167;9</a><br/>Inform 6 Objects - <a href="4-i6o.html#SP5">&#167;5</a>, <a href="4-i6o.html#SP6">&#167;6</a>, <a href="4-i6o.html#SP7">&#167;7</a>, <a href="4-i6o.html#SP8">&#167;8</a><br/>C Object Model - <a href="5-com.html#SP12">&#167;12</a>, <a href="5-com.html#SP16">&#167;16</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">object_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">object_kind</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">object_kind</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterTypes::is_unchecked</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterTypes::from_type_name</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TypenameInstruction::is_a</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b><span class="extract"><span class="extract-syntax">TRUE</span></span> for a kind which can have properties but is not any sort of object.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::value_kind_with_properties</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::value_kind_with_properties</span></span>:<br/><a href="2-vo.html#SP4_1">&#167;4.1</a><br/>Inform 6 Objects - <a href="4-i6o.html#SP5">&#167;5</a>, <a href="4-i6o.html#SP6">&#167;6</a>, <a href="4-i6o.html#SP13_2">&#167;13.2</a>, <a href="4-i6o.html#SP13_3">&#167;13.3</a><br/>C Object Model - <a href="5-com.html#SP12">&#167;12</a>, <a href="5-com.html#SP25_1">&#167;25.1</a>, <a href="5-com.html#SP25_2">&#167;25.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vo.html#SP7" class="function-link"><span class="function-syntax">VanillaObjects::is_kind_of_object</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">RunningPipelines::get_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">object_kind_RPSYM</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterTypes::is_unchecked</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterTypes::from_type_name</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">FL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TypenameInstruction::permissions_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterNodeList::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">FL</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">instances_in_declaration_order</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TypenameInstruction::is_a</span><span class="plain-syntax">(</span><span class="identifier-syntax">InstanceInstruction::typename</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">), </span><span class="identifier-syntax">kind_s</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">FL</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InstanceInstruction::permissions_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterNodeList::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">FL</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b><span class="extract"><span class="extract-syntax">TRUE</span></span> for a property which might be held by one or more instances which
are not objects.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::is_property_of_values</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::is_property_of_values</span></span>:<br/>Inform 6 Objects - <a href="4-i6o.html#SP4_2_1">&#167;4.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_node_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PL</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">InterWarehouse::get_node_list</span><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">InterTree::warehouse</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PropertyInstruction::permissions_list</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_s</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">PL</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no permissions list"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_INTER_NODE_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">PL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PermissionInstruction::owner</span><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad owner"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner_kind_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSymbol::definition</span><span class="plain-syntax">(</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Inode::is</span><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">INSTANCE_IST</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">owner_kind_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InstanceInstruction::typename</span><span class="plain-syntax">(</span><span class="identifier-syntax">owner_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">owner_kind_s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">owner_s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vo.html#SP7" class="function-link"><span class="function-syntax">VanillaObjects::is_kind_of_object</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">owner_kind_s</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b><span class="extract"><span class="extract-syntax">TRUE</span></span> for an either-or property.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::is_either_or_property</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::is_either_or_property</span></span>:<br/><a href="2-vo.html#SP2_2">&#167;2.2</a>, <a href="2-vo.html#SP2_2_1_1">&#167;2.2.1.1</a><br/>Inform 6 Objects - <a href="4-i6o.html#SP4_2">&#167;4.2</a><br/>C Object Model - <a href="5-com.html#SP20">&#167;20</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterTypes::of_symbol</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterTypes::constructor_code</span><span class="plain-syntax">(</span><span class="identifier-syntax">type</span><span class="plain-syntax">) == </span><span class="identifier-syntax">INT2_ITCONC</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>The spatial depth is a piece of metadata attached to an instance which gives
its depth in the containment tree. This is meaningful only in interactive fiction
projects. For example, a map in a crate in an Attic room will have a spatial
depth of 2: the crate will have depth 1, the room depth 0.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaObjects::spatial_depth</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">VanillaObjects::spatial_depth</span></span>:<br/>Inform 6 Objects - <a href="4-i6o.html#SP7_1">&#167;7.1</a><br/>C Object Model - <a href="5-com.html#SP16_1">&#167;16.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSymbol::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">inst_s</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Metadata::read_optional_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^spatial_depth"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-vf.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-fm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-cg.html">cg</a></li><li class="progresssection"><a href="2-cg2.html">cg2</a></li><li class="progresssection"><a href="2-vnl.html">vnl</a></li><li class="progresssection"><a href="2-vc.html">vc</a></li><li class="progresssection"><a href="2-vf.html">vf</a></li><li class="progresscurrent">vo</li><li class="progresssection"><a href="2-vc2.html">vc2</a></li><li class="progresssection"><a href="2-vi.html">vi</a></li><li class="progresschapter"><a href="3-fti.html">3</a></li><li class="progresschapter"><a href="4-fi6.html">4</a></li><li class="progresschapter"><a href="5-fnc.html">5</a></li><li class="progressnext"><a href="2-vc2.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

